cmake_minimum_required(VERSION 3.5.1)
project(List)

if(BUILD_TOTAL STREQUAL ON)  # 是否只构建单个库文件
	set(SQLIST_SRC SqList/sqlist.c)
	set(SLLIST_SRC SLList/sllist.c)

	set(LIST_SRC ${SQLIST_SRC} ${SLLIST_SRC})

	add_library(LList STATIC ${LIST_SRC})
	add_library(llist SHARED ${LIST_SRC})

	install(TARGETS LList ARCHIVE DESTINATION ${INSTALL_DIR}/lib/liblds)
	install(TARGETS llist LIBRARY DESTINATION ${INSTALL_DIR}/lib/${CMAKE_LIBRARY_ARCHITECTURE})
	install(FILES ${INCLUDE_DIR}/List/*.h DESTINATION
		${INSTALL_DIR}/include/liblds)
else()
	add_subdirectory(SqList/) # Sequence List 顺序表
	add_subdirectory(SLList/) # Singly Linked List 单链表
	add_subdirectory(DLList/) # Doubly Linked List 双链表
endif()
